package mbcontrol;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import model.ConnectDb;
import dao.CartaoBandeiraJDBCCadastro;
import dao.PersistConexao;

public class MBSelectCartaoBand {
	private ConnectDb connectdb = new ConnectDb();
	String schema = connectdb.getSchema_producao();
	String user = connectdb.getUser();
	String pass = connectdb.getPass();

	private String nmcartbandeira;
	private String cdcartbandeira;

	private Map<String, String> snmcartbandeira = new HashMap<String, String>();

	ResultSet result = null;
	public static String scartbandeira;
	public static String scdcartbandeira;

	public MBSelectCartaoBand() {
		PersistConexao persistconexao = new PersistConexao();
		Connection conexao = persistconexao.openConecao(schema, user, pass);

		snmcartbandeira = new HashMap<String, String>();
		CartaoBandeiraJDBCCadastro daoinst = new CartaoBandeiraJDBCCadastro(
				conexao);
		result = daoinst.ResultCartBandeira();
		try {
			result.first();
			while (!result.isAfterLast()) {
				snmcartbandeira.put(result.getString("NMCARTAOBANDEIRA"),
						result.getString("CDCARTAOBANDEIRA"));
				scdcartbandeira = result.getString("CDCARTAOBANDEIRA");
				System.out.println("CODIGO Cartao Bandeira " + scdcartbandeira);
				result.next();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public Map<String, String> getSnmcartbandeira() {
		return snmcartbandeira;
	}

	public void setSnmcartbandeira(Map<String, String> snmcartbandeira) {
		this.snmcartbandeira = snmcartbandeira;
	}

	public String getCdcartbandeira() {
		return cdcartbandeira;
	}

	public void setCdcartbandeira(String cdcartbandeira) {
		this.cdcartbandeira = cdcartbandeira;
	}

	public String getNmcartbandeira() {
		return nmcartbandeira;
	}

	public void setNmcartbandeira(String nmcartbandeira) {
		this.nmcartbandeira = nmcartbandeira;
	}

}
